package com.garen.orm;

import java.util.HashMap;
import java.util.Map;

import javax.sql.DataSource;

/*
 * ormdbtype工厂
 * 用于创建维护OrmDBType实例
 * */
public class OrmDBTypeFactory {

	private static Map<String,OrmDBType> dbtypeMap = new HashMap<>();
	
	public static OrmDBType create(DataSource dataSource){
		String code = dataSource.hashCode() + "";
		OrmDBType ormdb = dbtypeMap.get(code);
		if(ormdb == null){
			ormdb = new OrmDBType(dataSource);
			dbtypeMap.put(code,ormdb);
		}
		return ormdb;
	}
	
}
